#!/usr/bin/env python

from resource_management.libraries.script import Script
from resource_management.libraries.functions import default

# server configurations
config = Script.get_config()
stack_root = Script.get_stack_root()


mlsql_user = config['configurations']['mlsql-env']['mlsql_user']
user_group = config['configurations']['cluster-env']['user_group']
log_dir = config['configurations']['mlsql-env']['mlsql_log_dir']

hostname = config['agentLevelParams']['hostname']

#comon
download_url_console = config['configurations']['mlsql-env'][ 'download_url_console']
download_url_engine = config['configurations']['mlsql-env']['download_url_engine']
mlsql_log_dir = config['configurations']['mlsql-env']['mlsql_log_dir']
mlsql_pid_dir = config['configurations']['mlsql-env']['mlsql_pid_dir']

install_dir = config['configurations']['mlsql-common-conf']['install_dir']
download_engine_file =  config['configurations']['mlsql-env']['download_engine_file']
download_console_file =  config['configurations']['mlsql-env']['download_console_file']

java_home = config['configurations']['mlsql-env']['java_home']
spark_home = config['configurations']['mlsql-env']['spark_home']

# skip console script inport
skip_console_script_inport = config['configurations']['mlsql-common-conf']['skip_console_script_inport']
skip_modify_sql_script_datatype_256to255 = config['configurations']['mlsql-common-conf']['skip_modify_sql_script_datatype_256to255']
#databases
db_url = config['configurations']['mlsql-common-conf']['db_url']
db_user = config['configurations']['mlsql-common-conf']['db_user']
db_password = config['configurations']['mlsql-common-conf']['db_password']

console_db = config['configurations']['mlsql-common-conf']['console_db']
# db_user = "root"
# db_password = "123456"

#engine
engine_conf_start_default_sh = config['configurations']['mlsql-engine-env']['engine_conf_start_default_sh']
engine_conf_start_local_sh = config['configurations']['mlsql-engine-env']['engine_conf_start_local_sh']


#console
console_conf_start_default_sh = config['configurations']['mlsql-env']['console_conf_start_default_sh']
console_conf_start_sh = config['configurations']['mlsql-env']['console_conf_start_sh']
console_conf_application_docker_yml = config['configurations']['mlsql-env']['console_conf_application_docker_yml']

# filename_console = download_url_console.split('/')[-1]
# version_dir_console = filename_console.replace('.tar.gz', '').replace('.tgz', '')

#scripts
mlsql_engine_script = config['configurations']['mlsql-start-scripts'][ 'mlsql_engine_script']
mlsql_console_script = config['configurations']['mlsql-start-scripts'][ 'mlsql_console_script']

